import { post } from "../request";

const prefix = "/ytdzdt-server";

// export function onemapFrontApi(data) {
//   return post('/geoserver-open/rest/query/onemap_front', data)
// }

export function onemapFrontApi(data) {
  return post(
    prefix + "/MapDomain/SystemAccessService/oneMapOverview/v1",
    data
  );
}

export function zydk_plan_analysis(filterStr) {
  const data = {
    ApplicationGUID: "8879849f-0087-4db5-a8f2-386aa5e8b0ca",
  };
  if (filterStr) data["Filter"] = { regioncode: filterStr };
  return post("/geoserver-open/rest/query/zydk_plan_analysis", data);
}
export function zydk_previouscorp_sheng_in(filterStr) {
  const data = {
    ApplicationGUID: "8879849f-0087-4db5-a8f2-386aa5e8b0ca",
  };
  if (filterStr) data["Filter"] = { regioncode: filterStr };
  return post("/geoserver-open/rest/query/zydk_previouscorp_sheng_in", data);
}
export function zydk_previouscorp_shi_in(filterStr) {
  const data = {
    ApplicationGUID: "8879849f-0087-4db5-a8f2-386aa5e8b0ca",
  };
  if (filterStr) data["Filter"] = { regioncode: filterStr };
  return post("/geoserver-open/rest/query/zydk_previouscorp_shi_in", data);
}
export function zydk_previouscorp_xian_in(filterStr) {
  const data = {
    ApplicationGUID: "8879849f-0087-4db5-a8f2-386aa5e8b0ca",
  };
  if (filterStr) data["Filter"] = { regioncode: filterStr };
  return post("/geoserver-open/rest/query/zydk_previouscorp_xian_in", data);
}
export function zydk_previouscorp_sheng_out(filterStr) {
  const data = {
    ApplicationGUID: "8879849f-0087-4db5-a8f2-386aa5e8b0ca",
  };
  if (filterStr) data["Filter"] = { regioncode: filterStr };
  return post("/geoserver-open/rest/query/zydk_previouscorp_sheng_out", data);
}
export function zydk_previouscorp_xian_out(filterStr) {
  const data = {
    ApplicationGUID: "8879849f-0087-4db5-a8f2-386aa5e8b0ca",
  };
  if (filterStr) data["Filter"] = { regioncode: filterStr };
  return post("/geoserver-open/rest/query/zydk_previouscorp_xian_out", data);
}
export function zydk_previouscorp_shi_out(filterStr) {
  const data = {
    ApplicationGUID: "8879849f-0087-4db5-a8f2-386aa5e8b0ca",
  };
  if (filterStr) data["Filter"] = { regioncode: filterStr };
  return post("/geoserver-open/rest/query/zydk_previouscorp_shi_out", data);
}
export function zydk_planline_analysis(regionFilter, year = 2023) {
  const data = {
    ApplicationGUID: "8879849f-0087-4db5-a8f2-386aa5e8b0ca",
    Filter: {
      year: year,
    },
  };
  // if (regionCode && regionCode !== '1') data.Filter.regioncode = `and coun_division_code like '${regionCode}%'`
  if (regionFilter) data.Filter.regioncode = regionFilter;
  return post("/geoserver-open/rest/query/zydk_planline_analysis", data);
}

export function zydk_previouscrop_analysis(filterStr) {
  const data = {
    ApplicationGUID: "8879849f-0087-4db5-a8f2-386aa5e8b0ca",
  };
  if (filterStr) data["Filter"] = { regioncode: filterStr };
  return post("/geoserver-open/rest/query/zydk_previouscrop_analysis", data);
}
export function zydk_previouscrop_lineanalysis(regionFilter, year = 2023) {
  const data = {
    ApplicationGUID: "8879849f-0087-4db5-a8f2-386aa5e8b0ca",
    Filter: {
      year: year,
    },
  };
  if (regionFilter) data.Filter.regioncode = regionFilter;
  // if (regionCode && regionCode !== '1') data.Filter.regioncode = `and coun_division_code like '${regionCode}%'`
  return post(
    "/geoserver-open/rest/query/zydk_previouscrop_lineanalysis",
    data
  );
}

export function getScaleUpAnalysis(data) {
  return post(
    "/ytdzdt-server/MapDomain/BasicAnalysisService/getScaleUpAnalysis/v1",
    data
  );
}
export function zydk_plan_findxzqdm(filterStr) {
  const data = {
    ApplicationGUID: "8879849f-0087-4db5-a8f2-386aa5e8b0ca",
  };
  if (filterStr) data["Filter"] = { regionname: filterStr };
  return post("/geoserver-open/rest/query/zydk_plan_findxzqdm", data);
}
export function zydk_crop_sheng_in(filterStr) {
  const data = {
    ApplicationGUID: "8879849f-0087-4db5-a8f2-386aa5e8b0ca",
  };
  if (filterStr) data["Filter"] = { regioncode: filterStr };
  return post("/geoserver-open/rest/query/zydk_crop_sheng_in", data);
}
export function zydk_crop_shi_in(filterStr) {
  const data = {
    ApplicationGUID: "8879849f-0087-4db5-a8f2-386aa5e8b0ca",
  };
  if (filterStr) data["Filter"] = { regioncode: filterStr };
  return post("/geoserver-open/rest/query/zydk_crop_shi_in", data);
}
export function zydk_crop_xian_in(filterStr) {
  const data = {
    ApplicationGUID: "8879849f-0087-4db5-a8f2-386aa5e8b0ca",
  };
  if (filterStr) data["Filter"] = { regioncode: filterStr };
  return post("/geoserver-open/rest/query/zydk_crop_xian_in", data);
}
export function zydk_crop_sheng_out(filterStr) {
  const data = {
    ApplicationGUID: "8879849f-0087-4db5-a8f2-386aa5e8b0ca",
  };
  if (filterStr) data["Filter"] = { regioncode: filterStr };
  return post("/geoserver-open/rest/query/zydk_crop_sheng_out", data);
}
export function zydk_crop_xian_out(filterStr) {
  const data = {
    ApplicationGUID: "8879849f-0087-4db5-a8f2-386aa5e8b0ca",
  };
  if (filterStr) data["Filter"] = { regioncode: filterStr };
  return post("/geoserver-open/rest/query/zydk_crop_xian_out", data);
}
export function zydk_crop_shi_out(filterStr) {
  const data = {
    ApplicationGUID: "8879849f-0087-4db5-a8f2-386aa5e8b0ca",
  };
  if (filterStr) data["Filter"] = { regioncode: filterStr };
  return post("/geoserver-open/rest/query/zydk_crop_shi_out", data);
}
